﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ASCII.Common;
using PlayDeezGames.Common;

namespace ASCII.ClickTheYellowBox
{
    public class CTYBGameOverState:CTYBStateBase
    {
        private DispatcherTimer timer = new DispatcherTimer();

        protected override void OnStart()
        {
            timer.Start();
            Renderer.WriteText(11, 14, "Game Over!", ASCIICellColor.Magenta, ASCIICellColor.Black);
        }

        protected override void OnIdle()
        {
        }

        protected override void OnFinish()
        {
            ExitState = CTYBState.Title;
        }
        private void timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();
            Finish();
            Parent.OnMessage(new MessageBase(StateMachine<CTYBState>.MSGID_Step));
        }
        public CTYBGameOverState(ASCIIRenderer theRenderer)
            : base(theRenderer)
        {
            timer.Interval = new TimeSpan(0, 0, 5);
            timer.Tick += new EventHandler(timer_Tick);
        }
    }
}
